package hostlink

//hostlink fins serial  报文结构
const (
	HK_TITLE    string = "@" // 开始标记
	HK_HEADCODE string = "FA"
	HK_RESTIM   string = "0"
	HK_ICF      string = "00"
	HK_DA2      string = "00"
	HK_SA2      string = "00"
	HK_SID      string = "00"
	HK_READE    string = "0101"
	HK_WRITE    string = "0102"
)

//功能区类型
const (
	//HOSTLINK C-MODE类型
	WordCode_RR string = "RR" // WordCode:   RR  	CIO    输入字  0-99   输出字  100-199   串行PLC链接字 200-289
	WordCode_RL string = "RL" //			 RL     CIO    1000-1199 链路继电器区
	WordCode_RH string = "RH" // 			 RH    	  H    保持区  0-49
	WordCode_RD string = "RD" //			 RD    	  D    数据存储区  E型CPU  0-2047    N/NA型CPU 0-8191
	WordCode_RG string = "RG" //			 RC/RG    T    定时器区 0-255
	WordCode_RC string = "RC" //			 RC/RG    C    计数器区 0-255
	WordCode_RA string = "RJ" //			 RJ       A    辅助区   只读0-447   读/写 448-753
	WordCode_RE string = "RE" //			 RE   	  E		E00000-E09999

	//	HOSTLINK FINS 类型
	//字地址
	WordCode_FINS_Word_CIO = "B0" //WordCode :	CIO Area
	WordCode_FINS_Word_WR  = "B1" // 			Work Area
	WordCode_FINS_Word_HR  = "B2" // 			Holding Bit Area
	WordCode_FINS_Word_AR  = "B3" //			Auxiliary Bit Area
	WordCode_FINS_Word_DM  = "82" // 			DM Area

	//位地址
	WordCode_FINS_Bit_CIO = "30"
	WordCode_FINS_Bit_WR  = "31"
	WordCode_FINS_Bit_HR  = "32"
	WordCode_FINS_Bit_AR  = "33"
	WordCode_FINS_Bit_DM  = "02"
)

//数据类型
const (
	HOSTLINK_COILS = iota + 1 //开关量
	HOSTLINK_INT16
	HOSTLINK_INT16_L
	HOSTLINK_UINT16
	HOSTLINK_UINT16_L
	HOSTLINK_INT32
	HOSTLINK_INT32_L
	HOSTLINK_INT32_H
	HOSTLINK_UINT32
	HOSTLINK_UINT32_L
	HOSTLINK_UINT32_H
	HOSTLINK_FLOAT
	HOSTLINK_FLOAT_L
	HOSTLINK_FLOAT_H
	HOSTLINK_INT64_H
	HOSTLINK_INT64_L
	HOSTLINK_UINT64_H
	HOSTLINK_UINT64_L
	HOSTLINK_STRING
	HOSTLINK_DOUBLE
)

//协议 类型
const (
	HOSTLINK_CMODE = iota //c-mode 协议
	HOSTLINK_FINS         //FINS   协议
)

/*
Frame Format
var (
	ICF 			 //网络中继配置        0x80有网络中继 0x00无网络中继
	RSV  			 //系统保留       	 (Reserverd by system)
	GCT 			 //允许的网关数量		(Permissible Number of Gateways)
	DNA 			 //目的网络地址  		(Destination Network Address) 00(Hex) Local network ;   01 to 7F Destination network address (1 to 127)
	DA1				 //目标节点号 		(Destination Network Address) 00(Hex) Local network ;	21 to FE Destination node address
	DA2 			 //目的单元地址		(Destination Unit  Address) 00(Hex) PLC(CPU Unit)

	SNA 			 //源(PC)网络地址     (Source Network Address)
	SA1 			 //源节点地址 		    (Source Node Address)
	SA2				 //源单元地址
	SID 			 // Service ID 可设为0 也可作为序列号
)
*/
